﻿using Blog.Domain;
using Core.Repository.Where;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace Blog.Application.Condition
{
   public class UserCondition
    {

        private UserCondition Condition { get; set; }
        /// <summary>
        /// 根据账号查询
        /// </summary>
        public string Account { get; set; }
        /// <summary>
        /// 构造表达式条件
        /// </summary>
        /// <returns></returns>
        public Expression<Func<User, bool>> BuildExpression()
        {
            ParseCondition<User> parse = new ParseCondition<User>();
            if (!string.IsNullOrEmpty(Account))
                parse.BuildExpression("Account", Account, ConditionOperation.Equal);
            return parse.BuildWhereExpression(); ;
        }
    }
}
